import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-todolist',
  templateUrl: './todolist.component.html',
  styleUrls: ['./todolist.component.css']
})
export class TodolistComponent implements OnInit {

  public todoTask:string;
  public taskList:any[]=[];

  constructor() { }

  ngOnInit(): void {
  }

  addtask(){
    if(this.taskList.indexOf(this.todoTask) == -1 && this.todoTask != ""){
        this.taskList.push(this.todoTask);
    }
    this.todoTask = ""
  }

  deletetask(key){
    this.taskList.splice(key,1);
  }

}
